* widget to a #GtkViewport, then add the viewport to the scrolled window.
* The convenience function gtk_scrolled_window_add_with_viewport() does
* exactly this, so you can ignore the presence of the viewport.
+ *
+ * The #GtkViewport will start scrolling content only if allocated less
+ * than the child widget's minimum size in a given orientation.
*/
struct _GtkViewportPrivate
child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{
- GtkRequisition child_requisition;
+ gint minimum_width;
- gtk_size_request_get_size (GTK_SIZE_REQUEST (child),
- &child_requisition, NULL);
- hadjustment->upper = MAX (child_requisition.width, view_allocation.width);
+ gtk_size_request_get_width_for_height (GTK_SIZE_REQUEST (child),
+ view_allocation.height,
+ &minimum_width,
+ NULL);
+ hadjustment->upper = MAX (minimum_width, view_allocation.width);
}
else
hadjustment->upper = view_allocation.width;
child = gtk_bin_get_child (bin);
if (child && gtk_widget_get_visible (child))
{
- gint natural_height;
+ gint minimum_height;
gtk_size_request_get_height_for_width (GTK_SIZE_REQUEST (child),
view_allocation.width,
- NULL,
- &natural_height);
- vadjustment->upper = MAX (natural_height, view_allocation.height);
+ &minimum_height,
+ NULL);
+
+ vadjustment->upper = MAX (minimum_height, view_allocation.height);
}
else
vadjustment->upper = view_allocation.height;